# file=[
#           ["F1_book_05448_chp_0038_reader_06708_1.wav","M1_book_11346_chp_0030_reader_00812_9.wav"],
#           ["F2_clean_fileid_9371.wav","M2_clean_fileid_11248.wav"],
#           ["M1_book_11346_chp_0030_reader_00812_9.wav","F1_book_05448_chp_0038_reader_06708_1.wav"],
#           ["M2_clean_fileid_11248.wav","F2_clean_fileid_9371.wav"],
#           ["F1_book_05448_chp_0038_reader_06708_1.wav","F2_clean_fileid_9371.wav","M2_clean_fileid_11248.wav"],
#           ["M1_book_11346_chp_0030_reader_00812_9.wav","M2_clean_fileid_11248.wav"],
          
          
#           ["F1_VCTK_unseen_p228_001_mic1.wav","M1_VCTK_p376_006_mic1.wav"],
#           ["F2_VCTK_unseen_p253_008_mic1.wav","M2_VCTK_unseen_p263_007_mic1.wav"],
#           ["M1_VCTK_p376_006_mic1.wav","F1_VCTK_unseen_p228_001_mic1.wav"],
#           ["M2_VCTK_unseen_p263_007_mic1.wav","F2_VCTK_unseen_p253_008_mic1.wav"],
#           ["F1_VCTK_unseen_p228_001_mic1.wav","F2_VCTK_unseen_p253_008_mic1.wav"],
#           ["M1_VCTK_p376_006_mic1.wav","M2_VCTK_unseen_p263_007_mic1.wav"]
#           ]
import os
import json

source_speaker=["p228F","p253F","p376M","p263M","p228F","p263M"]
target_speaker=["p376M","p263M","p228F","p253F","p253F","p376M"]
total=10

root_path="/home/wang/codes/py/VC/Evaluate_wavs"
pair_dict=list()

# for speaker_source in source_speaker:
#     for speaker_target in target_speaker:
for i in range(len(source_speaker)):
        speaker_source = source_speaker[i]
        speaker_target = target_speaker[i]
        
        source_speaker_dir=os.path.join(root_path,speaker_source)
        source_dir_wav_name=sorted(os.listdir(source_speaker_dir))
        
        target_speaker_dir=os.path.join(root_path,speaker_target)
        target_dir_wav_name=sorted(os.listdir(target_speaker_dir))
        
        # print(source_dir_wav_name[0])
        
        for index_source in range(len(source_dir_wav_name)):
            for index_target in range(len(target_dir_wav_name)):
                source_wav_path=os.path.join(speaker_source,source_dir_wav_name[index_source])
                target_wav_path=os.path.join(speaker_target,target_dir_wav_name[index_target])
                # pair_dict=list()
                # pair_dict.append(source_dir_wav_name)
                # pair_dict.append(target_dir_wav_name)
                # print(pair_dict)
                # print([source_wav_path,target_wav_path])
                pair_dict.append([source_wav_path,target_wav_path])
            
# for speaker_source in female_speaker:
#     for speaker_target in male_speaker:
        
#         source_speaker_dir=os.path.join(root_path,speaker_source)
#         source_dir_wav_name=sorted(os.listdir(source_speaker_dir))
        
#         target_speaker_dir=os.path.join(root_path,speaker_target)
#         target_dir_wav_name=sorted(os.listdir(target_speaker_dir))
        
#         # print(source_dir_wav_name[0])
        
#         for index in range(total):
#             source_wav_path=os.path.join(speaker_source,source_dir_wav_name[index*2])
#             target_wav_path=os.path.join(speaker_target,target_dir_wav_name[index*2])
#             # pair_dict=list()
#             # pair_dict.append(source_dir_wav_name)
#             # pair_dict.append(target_dir_wav_name)
#             # print(pair_dict)
#             # print([source_wav_path,target_wav_path])
#             pair_dict.append([source_wav_path,target_wav_path])
print(pair_dict)

with open('json_test2.txt','w+') as f:
    json.dump(pair_dict,f)